home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / smacros.lha / FWMacros / Load_Address.arexx < prev    next >
Text File  |  1994-12-17  |  4KB  |  130 lines

  1. /* Load_Address
  2. A Macro by Steven. R. Giovenella, 5823 Dutchess Dr., Colorado Springs, CO 80918.
  3. © Copyright 1994 Steven. R. Giovenella, All rights reserved. 
  4. This macro is my gift to the Amiga community.  It may be given away free to any
  5. one, but it may NOT be sold in any way, shape, or form, not even for the cost of re
  6. production, downloading, shipping, or handling, without express written permission 
  7. from the author listed above.  Any person or company who violates the content of 
  8. the previous sentence, agrees to pay Steven R. Giovenella $1,000 (US) for each copy 
  9. of this macro sold.  This macro may NOT be added to any disk which is to be sold for 
  10. any price or fee, to include shipping and handling.  The ONLY way this macro may 
  11. be distributed is on a disk which is given away 100% free of all charges, or on via 
  12. telecommunications networks which do not charge any additional fee as a result of a 
  13. user downloading this particular macro.  This macro may only be reproduced in its 
  14. entirety, including all comment lines and code.  The individual user may alter this 
  15. macro for personal use, but may not then distribute the macro in any modified form.  
  16. If you wish, feel free to send me some cash, a Christmas card, some other piece of 
  17. software, or absolutely nothing as a gift for creating this macro.  The author of this 
  18. software is not responsible for any data loss or damage to computer equipment as a 
  19. result, direct or indirect, of the use of this macro. */
  20.  
  21. Options Results
  22.  
  23. /* Determine insertion point */
  24.     ShowMessage 1 0 '"Place cursor where you want " "the new address(es) in
  25. serted." "BEFORE BEGINNING THIS MACRO." "     OK, Go on!     " "     Stop!     " 
  26. ""'
  27.     IF Result = 2 THEN Exit
  28.     type " "
  29.     backspace
  30.  
  31. /* Open the data file */
  32.     RequestText '"Load Address" "Enter source Data File..." 
  33. "Address_DataFile.ASCII"'
  34.         datafile = Result
  35.     file = "FWDocs/" || datafile
  36.     Open file
  37.     type " "
  38.     backspace
  39.  
  40. /* Address the data file */
  41.     Status PortName
  42.         port = Result
  43.     portnumber = RIGHT(port,1) + 1
  44.     newport = "FINALW." || portnumber
  45.     ADDRESS VALUE newport
  46.     Cursor UP
  47.  
  48. BeginSearch:
  49.  
  50. /* Get a string to search for */
  51.     RequestText '"Load Address" "Enter search text" ""'
  52.         Searchtext = Result
  53.  
  54. /* Search for it */
  55.     Cursor RIGHT
  56.     MoveToLine 2 0
  57.     m=0
  58.     Find
  59.     DO Forever
  60.         Find searchtext
  61.         Status LinePos
  62.             coords = Result
  63.             PARSE VAR coords BegLine BegPos EndLine EndPos
  64.             IF EndPos~=0 THEN DO
  65.             m = m+1
  66.             CtrlUp
  67.             ShiftUP
  68.             AltDOWN
  69.             Cursor UP
  70.             AltUP
  71.             ShiftDOWN
  72.             AltDOWN
  73.             Cursor DOWN
  74.             extract
  75.             match.m = Result
  76.              AltUp
  77.             CtrlUp
  78.             ShiftUP
  79.             END
  80.             IF EndPos=0 THEN Leave
  81.         END
  82.  
  83. /* Reveal Matches */
  84.     ShowMessage 1 0 '" 'm'  match(es) found! " " " "" "     Continue     " " Start New 
  85. Search " "     Cancel     "'
  86.         IF Result = 2 THEN Call BeginSearch
  87.         IF Result = 3 THEN DO
  88.             Close FORCE
  89.             Exit
  90.             END
  91.  
  92. /* Switch Arexx ports */
  93.     ADDRESS VALUE port
  94.     Cursor LEFT
  95.     Cursor RIGHT
  96.     WinToFront
  97.  
  98. /* Load all addresses */
  99.     DO i = 1 to m
  100.         lastchar = ""
  101.         comma = 0
  102.         DO char = 1 to LENGTH(match.i)
  103.             thischar = RIGHT(LEFT(match.i , char),1)
  104.             IF thischar = "," THEN DO
  105.                 IF lastchar ~= "," THEN newparagraph
  106.                 comma = comma + 1
  107.                 IF comma=5 then DO
  108.                     backspace
  109.                     type ", "
  110.                     END
  111.                 IF comma=6 then DO
  112.                     backspace
  113.                     type "  "
  114.                     END
  115.                 END
  116.             IF thischar ~= "," THEN DO
  117.                 type thischar
  118.                 END
  119.             lastchar = thischar    
  120.             END
  121.         newparagraph
  122.         newparagraph
  123.         END
  124. /* Close Data File */
  125.     ADDRESS VALUE newport
  126.     Cursor LEFT
  127.     Cursor RIGHT
  128.     Close FORCE
  129.  
  130.